package ru.gelin.android.keyboard;

import android.content.Context;
import android.content.Intent;

import static ru.gelin.android.keyboard.IntentParams.ACTION_SHOW_INPUT_METHOD_PICKER;

/**
 *  Tools to create shortcut.
 */
public class Shortcut {

    /**
     *  Returns the intent which opens input method picker.
     */
    public static Intent getShowInputMethodPicketIntent() {
        return new Intent(ACTION_SHOW_INPUT_METHOD_PICKER);
    }

    /**
     *  Returns the intent which should be returned or passed to Launcher
     *  to create a shortcut.
     */
    public static Intent getExtraShortcutIntent(Context context) {
        Intent result = new Intent();
        result.putExtra(Intent.EXTRA_SHORTCUT_INTENT, getShowInputMethodPicketIntent());
        result.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.shortcut_label));
        result.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                Intent.ShortcutIconResource.fromContext(context, R.drawable.keyboard));
        return result;
    }

    private Shortcut() {
        //avoid instantiation
    }

}
